package com.youmans.eduservice.controller.front;

import com.youmans.commonutils.R;
import com.youmans.eduservice.entity.EduCourse;
import com.youmans.eduservice.entity.EduTeacher;
import com.youmans.eduservice.service.EduCourseService;
import com.youmans.eduservice.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/eduservice/indexFront")
public class IndexFrontController {
    @Autowired
    private EduCourseService eduCourseService ;

    @Autowired
    private EduTeacherService eduTeacherService ;

//    查询前8条热门课程，前四条名师
    @GetMapping("index")
    public R index(){
        List<EduCourse> courseList = eduCourseService.getList();

        List<EduTeacher> teacherList = eduTeacherService.getlist();


        return R.ok().data("eduList",courseList).data("teacherList",teacherList) ;
    }
}
